<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../../vue.js"></script>
</head>

<body>

  <div id="app">
    {{checkvalue}}
    <custom-checkbox v-model="checkvalue"></custom-checkbox>
  </div>


  <script>

    Vue.component('custom-checkbox', {
      model: {
        prop: 'checked', //默认值是：value
        event: 'change' //默认值：input
      },
      props: {
        checked: Boolean // value : String
      },
      template: `
      <input type="checkbox" :checked="checked"  @change="$emit('change',$event.target.checked)" />
      `


    })



    var vm = new Vue({
      el: "#app",
      data: {
        checkvalue: true
      }
    })

  </script>

</body>

</html>